<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/pages/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <title>用户角色选择</title>
    <%@ include file="/WEB-INF/pages/include/baseCSS.jsp"%>
</head>

<body>
<!-- Field Validation -->
<div class="panel" style="height:100%">
  <div class="panel-body" style="height:100%">
    <div class="row">
    	<form class="form-horizontal" role="form" id="user-role-form" >
    		<input type="hidden" id="roleids" name="roleids"/>
	    	<input type="hidden" id="userid" name="userid" value="${userid}"/>
	    	<div class="col-sm-6">
		    	<label class="control-label mb15">配置用户角色</label>
		        <div class="form-group">
		          <div class="col-sm-12 pl15">
			          <c:forEach var="record" items="${records}" varStatus="status">
			            <div class="bs-component">
			              <div class="checkbox-custom checkbox-info mb5">
			                <input type="checkbox" name="roleid" value="${record.id}" id="${record.id}" <c:if test="${!empty record.userroleid}">checked='checked'</c:if> />
			                <label for="${record.id}">${record.rolename}</label>
			              </div>
			           </div>
			          </c:forEach>
		          </div>
	    		</div>
	    	</div>
	    </form>
  </div>
</div>

<%@ include file="/WEB-INF/pages/include/baseJS.jsp"%>
<script type="text/javascript">
function dealValue(){
	var value = "";
	$.each($(":checked"), function(i, item) {
		value+=$(item).val()+",";
	});
	if(value.length>0)
		value = value.substring(0, value.length-1);
	$("#roleids").val(value);
}
</script>
<!-- END: PAGE SCRIPTS -->
</body>
</html>
